' and 1 for the monkey problem SB.txt rev for SB.exe 
'from
' and 1 for the monkey problem.bas for JB 2.0 b 2018-02-11
' test string new string array functions > and <

n start 100
.   i (bluatigro) fount this puzle in a book:
.     there are 5 person's + 1 monkey
.     they shipwrek on a Island
.     the fisrst day they colect kokonut's
.
. day 1:"
. I (bplus) am starting with a number of coconuts.
n cc start
dim pile(5) this is why we need string array! for 5 piles
. Say the coconuts collected by the people is start .
.
.     in the night happens this:
.     (each) person goes to the pile
.     divides it in 5 hides 1/5
.     and gives 1 to the monkey
.
. I (bplus) am paying the monkey first.
. I (bplus) am not cutting any coconuts into parts of coconuts.
.
. So Coconut inventory after first night:
[
	n persn persn + 1
	i persn > 5
		x
	f
	n cc cc - 1 
	n monk monk + 1 
	> piel persn int(cc/5)
	n cc cc - int(cc/5)
	< p piel persn
	. For person persn , their pile is p
]
.             and monkey has monk
.
. day 2"
.      the 2e day"
.      thay divide the remaining pile in 5"
.      and give 1 to the monkey"
.      now calc the size of every pile"
.
. Coconuts starting day 2, before final divvy is cc
n cc cc - 1 
n monk monk + 1     
n divee int(cc/5)
. After monkey gets one more coconut the divvy is divee
.
n persn 1
[
	< p piel persn
	n p p + divee
	> piel persn p
	n persn persn +1
	i persn > 5
		x
	f
]
n Remain start
n persn 1
[
	< p piel persn
	. For person persn , their pile is p
	n Remain Remain - p
	n persn persn + 1
	i persn > 5
		x
	f
]
. The monkey has monk coconuts.
n Remain Remain - monk
.
. Coconuts remaining are Remain for the monkey who programmed this inventory.
